package com.groupbuying.ordosmarathon.admin.controller;

import com.groupbuying.ordosmarathon.admin.service.MarathonAdminService;
import com.groupbuying.ordosmarathon.util.PageUtils;
import com.groupbuying.ordosmarathon.util.apiresult.ApiResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Author: WANGNING
 * @Email wyn20140226@aliyun.com
 * @Date: 2019/8/6 15:03
 * @Des 马拉松后台管理系统
 */
@RestController
@RequestMapping("/admin")
public class MarathonAdminController {
    private static final Logger logger = LoggerFactory.getLogger(MarathonAdminController.class);

    @Autowired
    private MarathonAdminService marathonAdminService;

    /**
     * 马拉松后台---支付查询
     */
    @GetMapping("/list")
    public PageUtils list(@RequestParam Map<String, Object> params) {
        logger.info("MarathonAdminController.list()-----请求马拉松后台支付查询接口：" + params.toString());
        PageUtils pageUtils = marathonAdminService.payList(params);
        return pageUtils;
    }

    /**
     * 马拉松后台---财务首页
     */
    @GetMapping("/homePage")
    public ApiResult statistics() {
        logger.info("MarathonAdminController.statistics()-----请求马拉松后台财务首页");
        Map condMap = marathonAdminService.homePage();
        return ApiResult.success(condMap);
    }

    /**
     * 马拉松后台---投屏抽奖
     */
    @GetMapping("/screen")
    public ApiResult screen(@RequestParam Map<String, Object> params) {
        logger.info("MarathonAdminController.screen()-----请求马拉松后台投屏抽奖:" + params.toString());
        params.put("type", "1");
        Map condMap = marathonAdminService.screen(params);
        return ApiResult.success(condMap);
    }

    /**
     * 马拉松后台---获取大转盘列表---娃娃机
     */
    @GetMapping("/wawajiDetaile")
    public ApiResult wawajiDetaile(@RequestParam Map<String, Object> params) {
        logger.info("MarathonAdminController.wawajiDetaile()-----请求马拉松后台娃娃机:" + params.toString());
        Map condMap = marathonAdminService.wawajiDetaile(params);
        return ApiResult.success(condMap);
    }

    /**
     * 马拉松后台---获取大转盘列表---垃圾分类详情列表
     */
    @GetMapping("/rubbishDetaile")
    public ApiResult rubbishDetaile(@RequestParam Map<String, Object> params) {
        logger.info("MarathonAdminController.rubbishDetaile()-----请求马拉松后台垃圾分类详情列表:" + params.toString());
        Map condMap = marathonAdminService.rubbishDetaile(params);
        return ApiResult.success(condMap);
    }

    /**
     * 马拉松后台---获取大转盘列表---模拟超市详情列表
     */
    @GetMapping("/marketDetaile")
    public ApiResult marketDetaile(@RequestParam Map<String, Object> params) {
        logger.info("MarathonAdminController.marketDetaile()-----请求马拉松后台模拟超市详情列表:" + params.toString());
        Map condMap = marathonAdminService.marketDetaile(params);
        return ApiResult.success(condMap);
    }

}
